home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Streams
- Date: 23 Jan 1996 04:27:03 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Jan22212703@qcd.lanl.gov>
- References: <4e0lp3$lkf@nic.wat.hookup.net>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: xenon@the-fix.sos.on.ca's message of Mon, 22 Jan 1996 18:27:41 GMT
-
- --text follows this line--
- In article <4e0lp3$lkf@nic.wat.hookup.net> xenon@the-fix.sos.on.ca writes:
- <snip>
- /* open a file for update */
- stream = fopen("DUMMY.FIL", "w+");
-
- /* write some data to the file */
- fprintf(stream, "%d %c %f", i, c, f);
-
- /* close the file */
- fclose(stream);
- <snip>
- This example taken out of the Borland Help library should work fine.
- Yet, nothing is written to the file "dummy.fil". although the file is
-
- For text streams, the last character in your file should be a
- newline. So, change the print statement to
-
- fprintf(stream, "%d %c %f\n", i, c, f);
-
- I do not know why you are getting an empty file: but the C standard
- does not guarantee that a text file with non-newline last character
- can be read back by the same C program identically to as written out.
-
- In any case, it is a bad example to put in a help file.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-